﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using StyleMVVM.Data.Activation;
using StyleMVVM.DependencyInjection;
using StyleMVVM.DependencyInjection.Impl;

namespace StyleMVVM.MVC.DependencyInjection
{
	public class ImportFromRequestPathAttribute : Attribute, IImportAttribute
	{
		public ImportFromRequestPathAttribute()
		{
			Required = true;
		}

		public bool Required { get; set; }

		public IImportAttributeInfo ProvideImportInfo(object memberInfo)
		{
			return new ImportAttributeInfo
				       {
					       Required = Required,
					       ImportName = "",
					       Volatile = false,
					       ExportActivator = new FuncExportActivator((x, y, z) => HttpContext.Current.Request.Path, false)
				       };
		}
	}
}